#pragma once 
#pragma once
#include <memory>
#include <unistd.h>

namespace TinyRPC{

// 用来控制文件描述符的销毁
class Fd : std::enable_shared_from_this<Fd>{
public:
    Fd(int fd):m_fd(fd){}
    ~Fd() {close(m_fd);}
    int fd() {return m_fd;}
private:
    int m_fd;
};

using FdPtr = std::shared_ptr<Fd>;
}